-
Notifications
You must be signed in to change notification settings - Fork 18
Add SvelteKit example with Cloudflare Pages #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…velte --platform=pages`
- Setup `bun x shadcn-svelte@latest init` - Fixed formatting in svelte.config.js by ensuring a newline at the end of the file. - Simplified types array in tsconfig.json for better readability. - Added unplugin-icons to Vite configuration for enhanced icon support.
- Added "include" property to tsconfig.json to include src and drizzle.config.ts - Enhanced wrangler.jsonc with compatibility flags and database configurations - Added D1 database configuration - Added KV namespace for auth session - Added R2 bucket for assets
…nd file validation
…uctions and database bindings
"better-auth": "^1.1.21" | ||
"@cloudflare/workers-types": "^4", | ||
"better-auth": "^1.1.21", | ||
"drizzle-orm": ">=0.37.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that the roadmap mentions Durable Objects, so I set drizzle-orm version 0.37 or higher. Durable Objects have been included since version 0.37.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I will need to look into drizzle for durable objects more - feel free to contribute in separate PR
} | ||
}, | ||
// @ts-expect-error FIX: `@cloudflare/workers-types` is not compatible | ||
kv: event?.platform?.env?.SVELTEKIT_PAGES_AUTH_SESSION_KV as KVNamespace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part keeps causing a type error, but I don't know why.
I thought adding
"@cloudflare/workers-types": "^4",
as a peer dependency would solve it, but it didn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other ways to access env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is cloudflare bug, currently safe to ignore
@imjlk - now that hyperdrive feature is merged, are you open to updating svelte kit example to use it? Once it works I'll happily takeover hosting the pages deployment and Postgres/sql db of course. |
Ok, I'll try to update it soon! |
Update the SvelteKit example to include shadcn-svelte, improve project structure, and enhance functionality with new components and configurations. This includes setting up database connections, user authentication, and setup instructions in the README.
I haven't tested whether there are any issues when following the README.md guide from the beginning, but the result of deploying during development was successful.
Based on the results merged in this PR, I am also planning to create an example for Hypderdrive, including the content that was previously closed (#7).
Please take a look. Thank you.